Method for calculating power-on hours of an electronic device and electronic device utilizing the same

ABSTRACT

An electronic device includes a processor, a timer and a memory device. The memory device stores a value for power-on hours. During the process of booting the electronic device, the processor triggers the timer to start counting down. When the timer expires, the processor updates the value of power-on hours.

CROSS REFERENCE TO RELATED APPLICATIONS

This Application claims priority of Taiwan Patent Application No.106124881, filed on Jul. 25, 2017, the entirety of which is incorporatedby reference herein.

BACKGROUND OF THE INVENTION Field of the Invention

The invention relates to an electronic device and method for calculatingpower-on hours (POH), which not only effectively reduces the cost of thehardware device and of research and development, but also can accuratelycalculate the power-on hours of the electronic device.

Description of the Related Art

For a certain period of time after the sale of an electronic product, ifthere is any damage that has not been caused by the customer, themanufacturer will generally provide the customer with free or discountedmaintenance services. This period of free or discounted maintenanceservice is called the warranty period. The expiry date of the warrantyperiod is usually determined by the date on which the customer activelyregistered the purchase of the electronic product via the Internet, orby the purchase date of the electronic product as recorded on thewarranty card.

However, the determination of the warranty period can become acontentious issue if the customer loses the warranty card, or if thecustomer claims that the product was damaged within the warranty period,but for some reason the product is not taken in for repair until afterwarranty period has expired.

In order to avoid such disagreements about the warranty period, methodsfor automatically calculating the power-on hours (abbreviated as POH) atthe product end and the corresponding device are provided. Based on theproposed device and methods, the power-on hours of the electronicproduct can not only be accurately recorded, which helps to accuratelydetermine the warranty period, but they can also be used as the basisfor a failure analysis when the electronic product becomes damaged, sothat the warranty repair service can be provided more smoothly bymanufacturers, and better maintenance services can be provided tocustomers.

BRIEF SUMMARY OF THE INVENTION

An electronic device and method for calculating power-on hours areprovided. An exemplary embodiment of an electronic device comprises aprocessor, a timer and a memory device. The memory device stores a valuefor power-on hours. During the process of booting the electronic device,the processor triggers the timer to start counting down. When the timerexpires, the processor updates the value of power-on hours.

In some embodiments, when the timer expires, the processor resets thetimer and triggers the timer to start counting down again, and when thetimer expires, the processor updates the value of power-on hours again.

In some embodiments, the processor sets a count value to be counted bythe timer and triggers the timer to start counting down from the countvalue and at the end of the countdown of the timer, and then theprocessor updates the value of power-on hours according to the countvalue.

In some embodiments, the timer is a TCO timer.

In some embodiments, the memory device further stores BIOS code of theelectronic device, wherein the processor triggers the timer by executingthe BIOS code.

An exemplary embodiment of a method for calculating power-on hours,suitable for an electronic device, comprises: triggering a timer tostart counting down during the process of booting the electronic device;and updating the value for power-on hours stored in a memory device whenthe timer expires.

In some embodiments, the method further comprises, when the timerexpires, resetting the timer and triggering the timer to start countingdown again; and when the timer expires again, updating the value ofpower-on hours again.

In some embodiments, the memory device further stores BIOS code of theelectronic device and the method further comprises: executing the BIOScode to trigger the timer.

In some embodiments, the method further comprises issuing an interruptsignal when the timer expires.

In some embodiments, the timer is a TCO timer of the electronic device.

A detailed description is given in the following embodiments withreference to the accompanying drawings.

BRIEF DESCRIPTION OF DRAWINGS

The invention can be more fully understood by reading the subsequentdetailed description and examples with references made to theaccompanying drawings, wherein:

FIG. 1 is an exemplary block diagram of an electronic device accordingto an embodiment of the invention;

FIG. 2 is a flow chart of a method for calculating power-on hoursaccording to an embodiment of the invention;

FIG. 3 is a schematic diagram of a device reading the value of power-onhours POH_Value according to an embodiment of the invention; and

FIG. 4 is a flow chart showing the method for calculating the power-onhours according to another embodiment of the invention.

DETAILED DESCRIPTION OF THE INVENTION

The following description is of the best-contemplated mode of carryingout the invention. This description is made for the purpose ofillustrating the general principles of the invention and should not betaken in a limiting sense. The scope of the invention is best determinedby reference to the appended claims.

FIG. 1 is an exemplary block diagram of an electronic device accordingto an embodiment of the invention. The electronic device 100 maycomprise a processor 102, a system bus 104, a memory device 106, such asa Non-Volatile memory (NVRAM), a timer 108, an interrupt controller 110and a real-time clock (RTC) 112. The system bus 104 may be furthercoupled to the input/output (I/O) device 114 (such as the keyboard, themouse, etc.), the read only memory (ROM) 116, the random access memory(RAM) 118.

According to an embodiment of the invention, the electronic device 100may be a personal computer, a laptop computer, a tablet computer, or thelikes. The memory device 106 may be a chip that stores the BIOS (BasicInput/Output System) code of the electronic device 100.

Note that FIG. 1 presents a simplified block diagram, in which only theelements relevant to the invention are shown. However, the inventionshould not be limited the structures and components shown in FIG. 1.

When the user presses the power key of the electronic device 100, theelectronic device 100 is provided with power and is started-up, and theprocess of booting the electronic device 100 begins. During the processof booting the electronic device 100, the processor 102 executes theBIOS code to initiate a serious of operations, comprising executing thepower-on self-test (POST) to check whether each fundamental hardwarecomponent functions normally, and then performing subsequent procedures.The BIOS code is configured to manage the system date, power mode, andconfigurations of the hardware devices, peripheral devices, and memorydevices.

According to an embodiment of the invention, besides the BIOS code ofthe electronic device 100, the memory device 106 also stores the valuefor power-on hours POH_Value. In the embodiments of the invention, thetimer 108 is repeatedly triggered by executing the BIOS code to keepcounting down, and the power-on hours POH of the electronic device 100is calculated based on the counting result of the timer 108. In thismanner accurate power-on hours POH can be obtained. The proposedelectronic device and methods for calculating power-on hours are furtherdiscussed in the following paragraphs.

According to an embodiment of the invention, the timer 108 may be atimer logic circuit, such as a TCO (Total Cost of Ownership) timer.

According to an embodiment of the invention, during the process ofbooting the electronic device 100, the processor 102 triggers the timer108 to start counting down, and when the timer 108 expires, theprocessor 102 updates the value of power-on hours POH_Value. To be morespecific, the processor 102 may set a count value T_Count to be countedby the timer as a predetermined time period, as an example, 10 minutes,and trigger the timer 108 to start counting down from the count valueT_Count. The processor 102 may perform other tasks as the timer 108 iscounting down. As an example, the processor 102 may keep executing theBIOS code to complete the boot process, or, after the boot process iscompleted and the operating system (OS) is entered, the processor 102may keep executing other system program codes.

At the end of the countdown of the timer 108 (that is, when the timer108 expires, or the timer 108 has finished counting the count valueT_Count), the timer 108 may issue an interrupt signal to notify theprocessor 102 of the timer expiration. For example, the interruptcontroller 110 may notify the processor 102 of the timer expirationafter receiving the interrupt signal. Upon receiving the interruptsignal, the processor 102 may execute a predetermined section of theprogram code in the BIOS code, so as to update the value of power-onhours POH_Value according to the count value T_Count. For example, everytime the processor 102 receives the interrupt signal issued by the timer108, the processor 102 accumulates the value of power-on hours POH_Valueaccording to the count value T_Count (that is, adding the T_Count to thevalue of power-on hours POH_Value), to obtain the latest value ofpower-on hours POH_Value. In addition, the processor 102 may reset thetimer 108 and trigger the timer 108 to start counting down again.Similarly, the processor 102 may perform other tasks as the timer 108 iscounting down. At the end of the countdown of the timer 108 (that iswhen the timer 108 expires), the timer 108 may issue an interrupt signalagain, to notify the processor 102 of the expiration. Upon receiving theinterrupt signal, the processor 102 may perform the similar operationsas discussed above again.

According to an embodiment, the timer 108 may be repeatedly set, resetand triggered, so as to keep calculating the power-on hours POH of theelectronic device 100. In this manner, accurate power-on hours POH canbe obtained.

In the conventional designs, the calculation of the power-on hours POHis usually carried out by an extra microprocessor. The microprocessormay calculate the power-on time based on its internal clock to obtainthe power-on hours POH. However, using the extra microprocessor not onlyincreases the hardware cost of the electronic device, but also increasesthe research and development cost of the electronic device sincecooperation of the corresponding firmware driver is also required.

Unlike the conventional design, in the embodiments of the invention, thebuilt-in timer inside of the electronic device 100, such as the TCOtimer in the X86 structures, is used. With the programming of the BIOScode, the power-on hours of the electronic device 100 can becontinuously calculated after the electronic device 100 is provided withpower and is started-up, and the value of the power-on hours POH_Valueis continuously and periodically updated. Therefore, in the embodimentof the invention, the steps of setting the timer 108, resetting thetimer 108, triggering the timer 108, and updating the value of thepower-on hours POH_Value can be performed by executing the BIOS code.

In this manner, there is no need to use an extra microprocessor, andaccurate power-on hours can be obtained. Not only the hardware cost andthe research and development cost of the electronic device can bereduced, but also accurate power-on hours can be obtained. The obtainedpower-on hours is helpful to accurately determine the warranty period,and can also be provided as the basis for failure analysis when theelectronic product is damaged.

FIG. 2 is a flow chart of a method for calculating power-on hoursaccording to an embodiment of the invention. First of all, the processof booting the electronic device is performed (Step S202). As discussed,when the electronic device 100 is provided with power and is started-up,and the processor 102 executes the BIOS code to start the process ofbooting the electronic device 100. Next, the processor 102 mayinitialize the timer 108 according to the BIOS code (Step S204) andtrigger the timer 108 to start counting down (Step S206). The operationsof initializing the timer 108 may comprise setting a count value T_Countto be counted by the timer 108 as a predetermined time period.

The timer 108 may keep counting down according to the system clock ofthe electronic device 108 until the timer 108 expires. When the timer108 expires (the “yes” path from the step S208), an interrupt signal isissued such that the processor 102 may reset the timer 180 based on theBIOS code (Step S210) in response to the interrupt signal, so as totrigger the timer 108 to count down again, and update the value ofpower-on hours POH_Value (Step S212). After updating the value ofpower-on hours POH_Value, the process returns to step S206 and the timer108 keeps counting down. In the embodiment of the invention, the timer108 may repeatedly be reset, so as to keep counting and updating thepower-on hours of the electronic device 100.

FIG. 3 is a schematic diagram of a device reading the value of power-onhours POH_Value according to an embodiment of the invention. In thisembodiment, the electronic device 300 is a personal computer. However,it should be noted that the invention should not be limited thereto.During the maintenance or inspection of the electronic device 300, thevalue of power-on hours POH_Value recorded by the electronic device 300can be read out by connecting an external device 350 to the electronicdevice 300. The power-on hours POH_Value may assist in determining thewarranty period or be provided as the basis for failure analysis whenthe electronic product is damaged.

According to another embodiment of the invention, when the electronicdevice enters the sleep state S3 or the hibernate state S4, the power-onhours POH_Value may keep being accumulated, so as to obtain a moreaccurate power-on hours. Based on the specification of AdvancedConfiguration and Power Interface (ACPI), the sleep state G1 can besubdivided into four states from S1 to S4 with different depths ofsleep. Among them, the sleep state S3 is also called as “suspend toRAM”. In this state, besides the main memory (RAM) which still has asmall amount of power supply, the hardware power of the remainingdevices within the computer system are all turned off. The hibernatestate S4 is also called as “suspend to disk”. In this state, the wholecomputer system is turned off after the data of the internal systemmemory is written in the hard disk. Therefore, the power consumption inthe hibernate state S4 is the same as the power consumption when thecomputer is shut down. In other words, when the electronic device entersthe sleep state (S3) or the hibernate state (S4), the hardware power ofmost of the devices within the computer system is turned off. Therefore,the designer may flexibly design whether to count the period of timeduring which the electronic device enters the sleep state (S3) or thehibernate state (S4) in the power-on hours POH_Value of the electronicdevice 100/300. Generally, more accurate power-on hours can be obtainedwhen the period of time during which the electronic device enters thesleep state (S3) or the hibernate state (S4) is counted in the power-onhours POH_Value of the electronic device 100/300.

Therefore, in another embodiment of the invention, when the electronicdevice is about to enter the sleep state (S3) or the hibernate state(S4) and before the sleep state (S3) or the hibernate state (S4) isentered, the processor 102 executes the corresponding BIOS code andreads the current time stamp (for example, the time stamp TimeStamp_1)of the RTC 112 according to the BIOS code, and records the time stamp inthe memory device (for example, the memory device 106 or the RAM 118).In addition, when the electronic device is woken up to leave the sleepstate (S3) or the hibernate state (S4), the processor 102 executes thecorresponding BIOS code and reads the current time stamp (for example,the time stamp Time Stamp_2) of the RTC 112 according to the BIOS code,and records the time stamp in the memory device (for example, the memorydevice 106 or the RAM 118).

Next, the processor 102 may further calculate the time span between thetwo time stamps TimeStamp_1 and TimeStamp_2, and update the value ofpower-on hours POH_Value according to the calculated time span. Forexample, adding the calculated time span to the recorded value ofpower-on hours POH_Value to obtain the latest value of power-on hoursPOH_Value.

Since the electronic device executes the corresponding BIOS code toperform some necessary task when the electronic device enters the sleepstate (S3) and the hibernate state (S4) and leaves the sleep state (S3)and the hibernate state (S4), by programing the BIOS code, the currenttime stamp of the RTC 112 will be read out and recorded when theelectronic device enters the sleep state (S3) and the hibernate state(S4) and leaves the sleep state (S3) and the hibernate state (S4).Therefore, the accurate time span between entering and leaving thesleep/hibernate state can be obtained and updated in the value ofpower-on hours POH_Value.

FIG. 4 is a flow chart showing the method for calculating the power-onhours according to another embodiment of the invention. First of all,when the electronic device is triggered and is about to enter the sleepstate (S3) or the hibernate state (S4) and before the sleep state (S3)or the hibernate state (S4) is entered, the processor 102 records thecurrent time stamp of the RTC 112 (Step S402). Next, the electronicdevice enters the sleep state (S3) or the hibernate state (S4) (StepS404). Next, when the electronic device leaves the sleep state (S3) orthe hibernate state (S4) (Step S406), the processor 102 records thecurrent time stamp of the RTC 112 (Step S408), calculates the time spanbetween two time stamps (Step S410) and updates the value of power-onhours according to the time span (Step S412). Next, the process mayreturn to step S206 and the timer 108 may keep counting down.

In the embodiment of the invention, when the electronic device 100/300is functioning, the power-on hours are calculated by using the timer108, and when the electronic device 100/300 enters the sleep state orthe hibernation state, the power-on hours is calculated by using the RTC112. In this manner, accurate power-on hours can be obtained withoutusing the extra microprocessor, and the hardware cost and the researchand development cost of the electronic device can be reduced. Inaddition, since there is no need to use the RTC 112 to calculate thepower-on hours when the electronic device 100/300 is functioning, theproblems derived from overreliance on the RTC 112 can be avoided.

Generally, the RTC has a back-up power supply that allows the RTC tocontinue counting when the host power is de-energized or unusable.However, when the back-up power supply of the RTC fails, or when theuser resets the system time, the timestamp of the RTC is changedaccordingly. In this way, erroneous power-on hours will be obtained whenthe RTC 112 is adopted to calculate the power-on hours when theelectronic device 100/300 is functioning.

In other words, based on the proposed electronic device and methods forcalculating the power-on hour, accurate power-on hours can be obtainedwithout using the extra microprocessor. Therefore, not only can thehardware cost and the research and development cost of the electronicdevice be reduced, but also the problems derived from using the RTC 112to calculate the power-on hours can be avoided. In this manner, thepower-on hours can be calculated more accurately as discussed above, andthe defects of the conventional designs can be overcome.

While the invention has been described by way of example and in terms ofpreferred embodiment, it is to be understood that the invention is notlimited thereto. Those who are skilled in this technology can still makevarious alterations and modifications without departing from the scopeand spirit of this invention. Therefore, the scope of the presentinvention shall be defined and protected by the following claims andtheir equivalents.

What is claimed is:
 1. An electronic device, comprising: a processor; areal-time clock (RTC); a timer; and a memory device, storing a value forpower-on hours, wherein during a process of booting the electronicdevice, the processor triggers the timer to start a counting downoperation, and responsive to the timer having finished the counting downoperation, the processor updates the value of power-on hours, wherein:responsive to the timer having finished the counting down operation, theprocessor resets the timer and triggers the timer to start the countingdown operation again, and responsive to the timer having finished thecounting down operation, the processor updates the value of power-onhours again, and wherein: the processor is configured to execute BIOScode of the electronic device during the process of booting theelectronic device, responsive to the electronic device entering a sleepstate or a hibernation state, the power-on hours are calculated by usingthe RTC, responsive to the electronic device leaving the sleep state orthe hibernation state, the power-on hours are calculated by using thetimer.
 2. The electronic device as claimed in claim 1, wherein theprocessor sets a count value to be counted by the timer, triggers thetimer to start the counting down operation from the count value and atthe end of the countdown of the timer, the processor updates the valueof power-on hours according to the count value.
 3. The electronic deviceas claimed in claim 1, wherein the timer is a TCO timer.
 4. Theelectronic device as claimed in claim 1, wherein the memory devicefurther stores the BIOS code of the electronic device, wherein theprocessor triggers the timer by executing the BIOS code.
 5. Theelectronic device as claimed in claim 1, wherein: responsive to theelectronic device entering the sleep state or the hibernation state, theprocessor records a first time stamp of the RTC in the memory device,responsive to the electronic device leaving the sleep state or thehibernation state, the processor records a second time stamp of the RTCin the memory device, and the processor reads the memory device tocalculate a time span between the first time stamp and the second timestamp and updates the value of power-on hours according to the timespan.
 6. The electronic device as claimed in claim 1, wherein theprocessor is a general processor.
 7. The electronic device as claimed inclaim 2, wherein at the end of the countdown of the timer, the processoradds the count value to the value of power-on hours to update the valueof power-on hours.
 8. The electronic device as claimed in claim 7,wherein responsive to the timer having finished the counting downoperation, the timer issues an interrupt signal to an interruptcontroller which notifies the processor such that the processor executesa predetermined section of the program code in the BIOS code to updatethe value of power-on hours.
 9. The electronic device as claimed inclaim 8, further comprising: a system bus coupled to the timer, theinterrupt controller, and the processor.
 10. A method for calculatingpower-on hours, suitable for an electronic device, comprising:executing, by a processor, BIOS code of the electronic device during theprocess of booting the electronic device; triggering a timer, by theprocessor, to start a counting down operation during the process ofbooting the electronic device; updating a value, by the processor, forpower-on hours stored in a memory device responsive to the timer havingfinished the counting down operation; responsive to the timer havingfinished the counting down operation, resetting the timer and triggeringthe timer to start the counting down operation again; responsive to thetimer having finished the counting down operation, updating the value ofpower-on hours again; and responsive to the electronic device entering asleep state or a hibernation state, the power-on hours are calculated byusing an real-time clock (RTC), wherein responsive to the electronicdevice leaving the sleep state or the hibernation state, the power-onhours are calculated by using the timer.
 11. The method as claimed inclaim 10, wherein the memory device further stores the BIOS code of theelectronic device and the timer is triggered by executing the BIOS code.12. The method as claimed in claim 10, further comprising: issuing aninterrupt signal responsive to the timer having finished the countingdown operation.
 13. The method as claimed in claim 10, wherein the timeris a TCO timer of the electronic device.
 14. The method as claimed inclaim 10, wherein the processor is a general processor.
 15. The methodas claimed in claim 11, further comprising: before the electronic deviceenters the sleep state the a hibernate state: reading the RTC to obtaina first time stamp; and recording the first time stamp in the memorydevice; after the electronic device leaves the sleep state or thehibernate state: reading the RTC to obtain a second time stamp;recording the second time stamp in the memory device; calculating a timespan between the first time stamp and the second time stamp; and addingthe time span to the value of power-on hours.